<?php
class ControllerHkCompanySetupLayout extends Controller {
private $error = array();

	public function index() {
		$this->language->load('hk/company_setup_layout');

		$this->document->setTitle($this->language->get('heading_title'));
		$this->load->model('hk/company_setup_layout');
		// var_dump(111);exit;

		$this->getList();
	}

	public function add() {
		$this->language->load('hk/company_setup_layout');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('hk/company_setup_layout');
		// var_dump($this->request->post);exit;
		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
			// var_dump($this->request->post);exit;
			// var_dump($this->request->post,$this->model_hk_company_setup_layout->getProjectFiles($this->request->post['no_1_child']));exit;
			$this->model_hk_company_setup_layout->addCompanySetupLayout($this->request->post);

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . $url, 'SSL'));
		}

		$this->getForm();
	}

	public function edit() {
		$this->language->load('hk/company_setup_layout');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('hk/company_setup_layout');

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
			// var_dump($this->request->post);exit;
			$this->model_hk_company_setup_layout->editCompanySetupLayout($this->request->get['id'], $this->request->post);

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . $url, 'SSL'));
		}

		$this->getForm();
	}

	public function delete() {
		$this->language->load('hk/company_setup_layout');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('hk/company_setup_layout');

		if (isset($this->request->post['selected']) && $this->validateDelete()) {
			foreach ($this->request->post['selected'] as $project_progress_id) {
				$this->model_hk_company_setup_layout->deleteVendorChecklist($project_progress_id);
			}

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . $url, 'SSL'));
		}

		$this->getList();
	}

	public function repair() {
		$this->language->load('hk/company_setup_layout');

		$this->document->setTitle($this->language->get('heading_title'));

		$this->load->model('hk/company_setup_layout');

		if ($this->validateRepair()) {
			$this->model_hk_company_setup_layout->repairCategories();

			$this->session->data['success'] = $this->language->get('text_success');

			$this->response->redirect($this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'], 'SSL'));
		}

		$this->getList();
	}

	protected function getList() {
		if (isset($this->request->get['filter_ckg_number'])) {
			$filter_ckg_number = $this->request->get['filter_ckg_number'];
		} else {
			$filter_ckg_number = null;
		}

		if (isset($this->request->get['filter_project_name'])) {
			$filter_project_name = $this->request->get['filter_project_name'];
		} else {
			$filter_project_name = null;
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$filter_english_name_of_supplier = $this->request->get['filter_english_name_of_supplier'];
		} else {
			$filter_english_name_of_supplier = null;
		}

		if (isset($this->request->get['filter_status'])) {
			$filter_status = $this->request->get['filter_status'];
		} else {
			$filter_status = null;
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$filter_customer_name = $this->request->get['filter_customer_name'];
			$filter_customer_value = $this->request->get['filter_customer_value'];
			// var_dump(111);exit;
		} else {
			$filter_customer_name = null;
			$filter_customer_value = null;
		}


		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'name';
		}

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'DESC';
		}

		if (isset($this->request->get['page'])) {
			$page = $this->request->get['page'];
		} else {
			$page = 1;
		}

		$url = '';
		if (isset($this->request->get['filter_ckg_number'])) {
			$url .= '&filter_ckg_number=' . urlencode(html_entity_decode($this->request->get['filter_ckg_number'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_project_name'])) {
			$url .= '&filter_project_name=' . urlencode(html_entity_decode($this->request->get['filter_project_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$url .= '&filter_english_name_of_supplier=' . urlencode(html_entity_decode($this->request->get['filter_english_name_of_supplier'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
			$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_status'])) {
			$url .= '&filter_status=' . $this->request->get['filter_status'];
		}

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}

		if (isset($this->request->get['order'])) {
			$url .= '&order=' . $this->request->get['order'];
		}

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
		);

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('heading_title'),
			'href' => $this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . $url, 'SSL')
		);

		$data['add'] = $this->url->link('hk/company_setup_layout/add', 'token=' . $this->session->data['token'] . $url, 'SSL');
		$data['delete'] = $this->url->link('hk/company_setup_layout/delete', 'token=' . $this->session->data['token'] . $url, 'SSL');
		$data['repair'] = $this->url->link('hk/company_setup_layout/repair', 'token=' . $this->session->data['token'] . $url, 'SSL');

		$data['projects'] = array();

		$filter_data = array(
			'filter_ckg_number'	  => $filter_ckg_number,
			'filter_project_name'	  => $filter_project_name,
			'filter_english_name_of_supplier' => $filter_english_name_of_supplier,
			'filter_customer_value'   => $filter_customer_value,
			'filter_customer_name'   => $filter_customer_name,
			'filter_status'   => $filter_status,
			'sort'  => $sort,
			'order' => $order,
			'start' => ($page - 1) * $this->config->get('config_limit_admin'),
			'limit' => $this->config->get('config_limit_admin')
		);
		$category_total = $this->model_hk_company_setup_layout->getTotalCompanySetup($filter_data);
		// var_dump($category_total);exit;
		$results = $this->model_hk_company_setup_layout->getCompanySetuplist($filter_data);
		// var_dump($results);exit;
		// var_dump(111);exit;
		foreach ($results as $result) {
			// var_dump((!empty($result['data']['no_1']))?substr($result['data']['no_1']['file_url'],54):'');exit;
			// $vendor_details_id_1 = (!empty($result['vendor_details_id_1']))?$this->url->link('vendor/vendor_details/edit', 'token=' . $this->session->data['token'] . '&vendor_details_id=' . $result['vendor_details_id_1'] , 'SSL'):'';

			// $vendor_details_id_2 = (!empty($result['vendor_details_id_2']))?$this->url->link('vendor/vendor_details/edit', 'token=' . $this->session->data['token'] . '&vendor_details_id=' . $result['vendor_details_id_2'] , 'SSL'):'';

			// $vendor_details_id_3 = (!empty($result['vendor_details_id_3']))?$this->url->link('vendor/vendor_details/edit', 'token=' . $this->session->data['token'] . '&vendor_details_id=' . $result['vendor_details_id_3'] , 'SSL'):'';

			$data['company_setup_layout'][] = array(
				'id' => $result['home_id'],
				'title_cn' => $result['title_cn'],
				'title_en' => $result['title_en'],
				'details_cn' => $result['details_cn'],
				'details_en' => $result['details_en'],

				'edit'        => $this->url->link('hk/company_setup_layout/edit', 'token=' . $this->session->data['token'] . '&id=' . $result['home_id'] . $url, 'SSL'),
				'delete'      => $this->url->link('hk/company_setup_layout/delete', 'token=' . $this->session->data['token'] . '&id=' . $result['home_id'] . $url, 'SSL'),
			);
			// var_dump($data['company_setup_layout']);exit;

		}
		// if(!is_array(isset($data['company_setup_layout']))){
		// 	$data['company_setup_layout'] = false;
		// }
		// var_dump($data['projects']);exit;
		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_list'] = $this->language->get('text_list');
		$data['text_no_results'] = $this->language->get('text_no_results');
		$data['text_confirm'] = $this->language->get('text_confirm');

		$data['text_status_1'] = $this->language->get('text_status_1');
		$data['text_status_2'] = $this->language->get('text_status_2');
		$data['text_status_3'] = $this->language->get('text_status_3');
		$data['text_status_4'] = $this->language->get('text_status_4');
		$data['text_status_4'] = $this->language->get('text_status_4');
		$data['text_status_0'] = $this->language->get('text_status_0');

		$data['button_filter'] = $this->language->get('button_filter');

		// $data['column_customer_search'] = $this->language->get('column_customer_search');

		$data['column_title_cn'] = $this->language->get('column_title_cn');
		$data['column_title_en'] = $this->language->get('column_title_en');
		$data['column_details_cn'] = $this->language->get('column_details_cn');
		$data['column_details_en'] = $this->language->get('column_details_en');
		//project

		$data['button_add'] = $this->language->get('button_add');
		$data['button_edit'] = $this->language->get('button_edit');
		$data['button_delete'] = $this->language->get('button_delete');
		$data['button_rebuild'] = $this->language->get('button_rebuild');


		$data['token'] = $this->session->data['token'];

		if (isset($this->error['warning'])) {
			$data['error_warning'] = $this->error['warning'];
		} else {
			$data['error_warning'] = '';
		}

		if (isset($this->session->data['success'])) {
			$data['success'] = $this->session->data['success'];

			unset($this->session->data['success']);
		} else {
			$data['success'] = '';
		}

		if (isset($this->request->post['selected'])) {
			$data['selected'] = (array)$this->request->post['selected'];
		} else {
			$data['selected'] = array();
		}

		$url = '';



		if (isset($this->request->get['filter_ckg_number'])) {
			$url .= '&filter_ckg_number=' . urlencode(html_entity_decode($this->request->get['filter_ckg_number'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_project_name'])) {
			$url .= '&filter_project_name=' . urlencode(html_entity_decode($this->request->get['filter_project_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$url .= '&filter_english_name_of_supplier=' . urlencode(html_entity_decode($this->request->get['filter_english_name_of_supplier'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
			$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_status'])) {
			$url .= '&filter_status=' . $this->request->get['filter_status'];
		}


		if ($order == 'ASC') {
			$url .= '&order=DESC';
		} else {
			$url .= '&order=ASC';
		}

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

		$data['sort_ckg_number'] = $this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . '&sort=ckg_number' . $url, 'SSL');
		$data['sort_project_name'] = $this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . '&sort=project_name' . $url, 'SSL');
		$data['sort_status'] = $this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . '&sort=status' . $url, 'SSL');

		$url = '';

		if (isset($this->request->get['filter_ckg_number'])) {
			$url .= '&filter_ckg_number=' . urlencode(html_entity_decode($this->request->get['filter_ckg_number'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_project_name'])) {
			$url .= '&filter_project_name=' . urlencode(html_entity_decode($this->request->get['filter_project_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$url .= '&filter_english_name_of_supplier=' . urlencode(html_entity_decode($this->request->get['filter_english_name_of_supplier'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
			$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_status'])) {
			$url .= '&filter_status=' . $this->request->get['filter_status'];
		}

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}



		$pagination = new Pagination();
		$pagination->total = $category_total;
		$pagination->page = $page;
		$pagination->limit = $this->config->get('config_limit_admin');
		$pagination->url = $this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');

		$data['pagination'] = $pagination->render();

		$data['results'] = sprintf($this->language->get('text_pagination'), ($category_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($category_total - $this->config->get('config_limit_admin'))) ? $category_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $category_total, ceil($category_total / $this->config->get('config_limit_admin')));

		$data['filter_ckg_number'] = $filter_ckg_number;
		$data['filter_project_name'] = $filter_project_name;
		$data['filter_english_name_of_supplier'] = $filter_english_name_of_supplier;
		$data['filter_customer_name'] = $filter_customer_name;
		$data['filter_customer_value'] = $filter_customer_value;
		$data['filter_status'] = $filter_status;

		$data['sort'] = $sort;
		$data['order'] = $order;

		$data['header'] = $this->load->controller('common/header');
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['footer'] = $this->load->controller('common/footer');
		$data['status_all'] = $this->model_hk_company_setup_layout->getProjectStatus();
		// var_dump(111);exit;
		$this->response->setOutput($this->load->view('hk/company_setup_layout_list.tpl', $data));
	}

	protected function getForm() {
		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_form'] = !isset($this->request->get['category_id']) ? $this->language->get('text_add') : $this->language->get('text_edit');
		$data['text_none'] = $this->language->get('text_none');
		$data['text_default'] = $this->language->get('text_default');
		$data['text_enabled'] = $this->language->get('text_enabled');
		$data['text_disabled'] = $this->language->get('text_disabled');

		$data['text_status_1'] = $this->language->get('text_status_1');
		$data['text_status_2'] = $this->language->get('text_status_2');
		$data['text_status_3'] = $this->language->get('text_status_3');
		$data['text_status_4'] = $this->language->get('text_status_4');
		$data['text_status_4'] = $this->language->get('text_status_4');
		$data['text_status_0'] = $this->language->get('text_status_0');

		$data['text_confirm_yes'] = $this->language->get('text_confirm_yes');
		$data['text_confirm_no'] = $this->language->get('text_confirm_no');

		$data['entry_upload'] = $this->language->get('entry_upload');
		$data['entry_overwrite'] = $this->language->get('entry_overwrite');
		$data['entry_progress'] = $this->language->get('entry_progress');

		$data['help_upload'] = $this->language->get('help_upload');

		$data['button_upload'] = $this->language->get('button_upload');
		$data['button_clear'] = $this->language->get('button_clear');
		$data['button_continue'] = $this->language->get('button_continue');

		$data['entry_title_cn'] = $this->language->get('entry_title_cn');
		$data['entry_title_en'] = $this->language->get('entry_title_en');

		$data['entry_details_cn'] = $this->language->get('entry_details_cn');
		$data['entry_details_en'] = $this->language->get('entry_details_en');






		$data['button_save'] = $this->language->get('button_save');
		$data['button_cancel'] = $this->language->get('button_cancel');

		$data['tab_general'] = $this->language->get('tab_general');
		$data['tab_data'] = $this->language->get('tab_data');
		$data['tab_design'] = $this->language->get('tab_design');

		if (isset($this->error['warning'])) {
			$data['error_warning'] = $this->error['warning'];
		} else {
			$data['error_warning'] = '';
		}

		
		if (isset($this->error['title_cn'])) {
			$data['error_title_cn'] = $this->error['title_cn'];
		} else {
			$data['error_title_cn'] = null;
		}
		if (isset($this->error['title_en'])) {
			$data['error_title_en'] = $this->error['title_en'];
		} else {
			$data['error_title_en'] = null;
		}


		$url = '';
		if (isset($this->request->get['filter_ckg_number'])) {
			$url .= '&filter_ckg_number=' . urlencode(html_entity_decode($this->request->get['filter_ckg_number'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_project_name'])) {
			$url .= '&filter_project_name=' . urlencode(html_entity_decode($this->request->get['filter_project_name'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_english_name_of_supplier'])) {
			$url .= '&filter_english_name_of_supplier=' . urlencode(html_entity_decode($this->request->get['filter_english_name_of_supplier'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_customer_name']) && isset($this->request->get['filter_customer_value']) ) {
			$url .= '&filter_customer_name=' . urlencode(html_entity_decode($this->request->get['filter_customer_name'], ENT_QUOTES, 'UTF-8'));
			$url .= '&filter_customer_value=' . urlencode(html_entity_decode($this->request->get['filter_customer_value'], ENT_QUOTES, 'UTF-8'));
		}

		if (isset($this->request->get['filter_status'])) {
			$url .= '&filter_status=' . $this->request->get['filter_status'];
		}

		if (isset($this->request->get['sort'])) {
			$url .= '&sort=' . $this->request->get['sort'];
		}

		if (isset($this->request->get['order'])) {
			$url .= '&order=' . $this->request->get['order'];
		}

		if (isset($this->request->get['page'])) {
			$url .= '&page=' . $this->request->get['page'];
		}

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
		);

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('heading_title'),
			'href' => $this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . $url, 'SSL')
		);

		if (!isset($this->request->get['id'])) {
			$data['action'] = $this->url->link('hk/company_setup_layout/add', 'token=' . $this->session->data['token'] . $url, 'SSL');
			$data['id'] = '';
		} else {
			$data['action'] = $this->url->link('hk/company_setup_layout/edit', 'token=' . $this->session->data['token'] . '&id=' . $this->request->get['id'] . $url, 'SSL');
			$data['id'] = $this->request->get['id'];
		}

		$data['cancel'] = $this->url->link('hk/company_setup_layout', 'token=' . $this->session->data['token'] . $url, 'SSL');

		$data['company_address'] =  $this->model_hk_company_setup_layout->getYbzAddress();

		if (isset($this->request->get['id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
			$category_info = $this->model_hk_company_setup_layout->getCompanySetup($this->request->get['id']);
		}
		// var_dump($category_info);exit;
		$data['token'] = $this->session->data['token'];

		$this->load->model('localisation/language');

		$data['languages'] = $this->model_localisation_language->getLanguages();

		if (isset($this->request->post['title_cn'])) {
			$data['title_cn'] = $this->request->post['title_cn'];
		} elseif (!empty($category_info)) {
			$data['title_cn'] = $category_info['title_cn'];
		} else {
			$data['title_cn'] = '';
		}

		if (isset($this->request->post['title_en'])) {
			$data['title_en'] = $this->request->post['title_en'];
		} elseif (!empty($category_info)) {
			$data['title_en'] = $category_info['title_en'];
		} else {
			$data['title_en'] = '';
		}

		if (isset($this->request->post['details_cn'])) {
			$data['details_cn'] = $this->request->post['details_cn'];
		} elseif (!empty($category_info)) {
			$data['details_cn'] = $category_info['details_cn'];
		} else {
			$data['details_cn'] = '';
		}

		if (isset($this->request->post['details_en'])) {
			$data['details_en'] = $this->request->post['details_en'];
		} elseif (!empty($category_info)) {
			$data['details_en'] = $category_info['details_en'];
		} else {
			$data['details_en'] = '';
		}


		$data['domian'] = HTTPS_CATALOG.'project/company_setup_layout/';

		$data['status_all'] = $this->model_hk_company_setup_layout->getProjectStatus();

		$data['header'] = $this->load->controller('common/header');
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['footer'] = $this->load->controller('common/footer');

		$this->response->setOutput($this->load->view('hk/company_setup_layout_form.tpl', $data));
	}

	protected function validateForm() {
		if ((utf8_strlen(trim($this->request->post['title_cn'])) < 1) || (utf8_strlen(trim($this->request->post['title_cn'])) > 200)) {
			$this->error['title_cn'] = $this->language->get('error_title_cn');
		}
		if ((utf8_strlen(trim($this->request->post['title_en'])) < 1) || (utf8_strlen(trim($this->request->post['title_en'])) > 200)) {
			$this->error['title_en'] = $this->language->get('error_title_en');
		}

		
		
		return !$this->error;
	}

	protected function validateDelete() {
		if (!$this->user->hasPermission('modify', 'hk/company_setup_layout')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		return !$this->error;
	}

	protected function validateRepair() {
		if (!$this->user->hasPermission('modify', 'hk/company_setup_layout')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		return !$this->error;
	}

}